<style>
	.dinheiro {
		float: right;
		font-weight: bold;
	}
	.label {
		display: block;
	}
	#logo_colegio {
    	background: url("../../../img/sistema/logo2.png") no-repeat scroll 0 0 transparent;
    	display: block;
    	height: 25px;
    	width: 76px;
	}
	#nome_colegio {
		display: block;
		font-size: 14px;
		font-weight: bold;
	}
	
	.sem_borda {
		border-style: hidden;
	}

	
	.sem_borda_bottom {
		border-bottom-style: hidden;
	}
	
	.sem_borda_left {
		border-left-style: hidden;
	}
	
	.sem_borda_rigth {
		border-rigth-style: hidden;
	}	
	
	.sem_borda_top {
		border-top-style: hidden;
	}
		
	table {
		border-collapse: collapse;
		font-family: verdana;
		font-size: 10px;
	}	
	.valores {
		height: 30px;
	}
	p.quebra { 
		page-break-before: always 
	}
	.divisao {
    	border-top: 1px dotted white;
    	margin-bottom: 25px;
    	margin-top: 25px;
	}
</style>

<?php

	$boletim  = '<table border="1" width="100%"';
	
		//=========================PARTE SUPERIOR DO BOLETIM
		
		$boletim .= '<tr><td><table border="0" width="100%">'; 
	
			$boletim .= '<tr class="sem_borda_bottom">';
			$boletim .= '<td rowspan="4" align="left">';
			$boletim .= '<span id="logo_colegio">colegio</span>';	
			$boletim .= '</td>';
			$boletim .= '<td align="left"><span class="label">&nbsp;</span></td>';	
			$boletim .= '<td align="center"><span class="label">BOLETIM ESCOLAR</span></td>';
			$boletim .= '<td align="center"><span class="label"></span>&nbsp;</td>';
			$boletim .= '</tr>';
			
			$boletim .= '<tr class="sem_borda_bottom">';
			$boletim .= '<td align="left"><span class="label">ALUNO: <b>#ALUNO_NOME#</b></span></td>';
			$boletim .= '<td align="left"><span class="label">Nº: <b>#ALUNO_NUMERO#</b></span></td>';
			$boletim .= '<td align="rigth"><span class="label">ANO LETIVO: <b>#ANO#</b></span></td>';
			$boletim .= '</tr>';		

			$boletim .= '<tr>';
			$boletim .= '<td align="left"><b>#SERIE#</b></td>';
			$boletim .= '<td align="left"><span class="label">TURNO: <b>#TURNO#</b></span></td>';
			$boletim .= '<td align="left"><span class="label">TURMA: <b>#TURMA#</b></span></td>';
			$boletim .= '</tr>';			

		$boletim .= '</table></td></tr>';
		
		//========================== CABEÇALHO DISCIPLINA E BIMESTRE 
		
		$boletim .= '<table border="1" width="100%" >'; 
	
				$boletim .= '<tr>';	
					$boletim .= '<td align="center" width="160" rowspan="2">DISCIPLINA</td>';
					$boletim .= '<td align="center" width="150" colspan="2">1º BIMESTRE</td>';
					$boletim .= '<td align="center" width="150" colspan="2">2º BIMESTRE</td>';
					$boletim .= '<td align="center" width="150"colspan="2">&nbsp;</td>';
					$boletim .= '<td align="center" width="150" colspan="2">3º BIMESTRE</td>';
					$boletim .= '<td align="center" width="150" colspan="2">4º BIMESTRE</td>';
					$boletim .= '<td align="center" width="100" class="sem_borda_bottom" >TOTAL</td>';
					$boletim .= '<td align="center" width="100" class="sem_borda_bottom" >PROVA</td>';	
					$boletim .= '<td align="center" width="150" class="sem_borda_bottom" >SITUAÇÃO</td>';				
				$boletim .= '</tr>';
				
				$boletim .= '<tr>';	
					$boletim .= '<td align="center" width="75">NOTA</td>';
					$boletim .= '<td align="center" width="75">FALTA</td>';
					$boletim .= '<td align="center" width="75">NOTA</td>';
					$boletim .= '<td align="center" width="75">FALTA</td>';	
					$boletim .= '<td align="center" width="75">TOTAL</td>';
					$boletim .= '<td align="center" width="75">RECUP</td>';
					$boletim .= '<td align="center" width="75">NOTA</td>';
					$boletim .= '<td align="center" width="75">FALTA</td>';
					$boletim .= '<td align="center" width="75">NOTA</td>';
					$boletim .= '<td align="center" width="75">FALTA</td>';
					$boletim .= '<td align="center" width="100">FINAL</td>';
					$boletim .= '<td align="center" width="100">FINAL</td>';
					$boletim .= '<td align="center" width="150">DO ALUNO</td>';					
				$boletim .= '</tr>';
					
		$boletim .= '</table>';	

		//========================== DETALHES DE DISCIPLINA E NOTA 
		
		$boletim .= '<table border="1" width="100%" >'; 
				
				$boletim .= '<tr>';	
					$boletim .= '<td align="center" width="163">#DISCIPLINA#</td>';
					$boletim .= '<td align="center" width="75">#NOTA1#</td>';
					$boletim .= '<td align="center" width="75">#FALTA1#</td>';
					$boletim .= '<td align="center" width="75">#NOTA2#</td>';
					$boletim .= '<td align="center" width="75">#FALTA2#</td>';	
					$boletim .= '<td align="center" width="75">#TOTAL#</td>';
					$boletim .= '<td align="center" width="75">#RECUP#</td>';
					$boletim .= '<td align="center" width="75">#NOTA3#</td>';
					$boletim .= '<td align="center" width="75">#FALTA3#</td>';
					$boletim .= '<td align="center" width="75">#NOTA4#</td>';
					$boletim .= '<td align="center" width="75">#FALTA4#</td>';
					$boletim .= '<td align="center" width="100">#TOT_FINAL#</td>';
					$boletim .= '<td align="center" width="100">#PROVA_FINAL#</td>';
					$boletim .= '<td align="center" width="150">#SITUACAO#</td>';					
				$boletim .= '</tr>';
				
		$boletim .= '</table>';		
		
		//========================== RODAPE BOLETIM

		$boletim .= '<table border="1" width="100%" >'; 
		
			$boletim .= '<tr><td><table width="100%" >'; 
			
					$boletim .= '<tr>';	
						$boletim .= '<td align="center" width="100">&nbsp;</td>';
					$boletim .= '</tr>';

					$boletim .= '<tr>';	
						$boletim .= '<td align="center" width="200">&nbsp;</td>';
						$boletim .= '<td align="center" colspan="3">ESCALA DE AVALIAÇÃO</td>';
						$boletim .= '<td align="center" width="100">&nbsp;</td>';
						$boletim .= '<td align="center" colspan="3">CONCEITO DE EDUCAÇÃO FÍSICA</td>';
						$boletim .= '<td align="center" width="100">&nbsp;</td>';	
					$boletim .= '</tr>';					
					
					$boletim .= '<tr>';	
						$boletim .= '<td align="center" width="200">&nbsp;</td>';
						$boletim .= '<td align="center" width="100">1º BIMESTRE</td>';
						$boletim .= '<td align="center" width="20">&nbsp;</td>';
						$boletim .= '<td align="center" width="100">20 PONTOS</td>';
						$boletim .= '<td align="center" width="300">&nbsp;</td>';
						$boletim .= '<td align="center" width="50">O</td>';
						$boletim .= '<td align="center" width="50">=</td>';
						$boletim .= '<td align="left"   width="100">ÓTIMO</td>';
						$boletim .= '<td align="center" width="200">&nbsp;</td>';	
					$boletim .= '</tr>';
					
					$boletim .= '<tr>';	
						$boletim .= '<td align="center" width="200">&nbsp;</td>';
						$boletim .= '<td align="center" width="100">2º BIMESTRE</td>';
						$boletim .= '<td align="center" width="20">&nbsp;</td>';
						$boletim .= '<td align="center" width="100">25 PONTOS</td>';
						$boletim .= '<td align="center" width="300">&nbsp;</td>';
						$boletim .= '<td align="center" width="50">B</td>';
						$boletim .= '<td align="center" width="50">=</td>';
						$boletim .= '<td align="left"   width="100">BOM</td>';
						$boletim .= '<td align="center" width="200">&nbsp;</td>';	
					$boletim .= '</tr>';

					$boletim .= '<tr>';	
						$boletim .= '<td align="center" width="200">&nbsp;</td>';
						$boletim .= '<td align="center" width="100">3º BIMESTRE</td>';
						$boletim .= '<td align="center" width="20">&nbsp;</td>';
						$boletim .= '<td align="center" width="100">25 PONTOS</td>';
						$boletim .= '<td align="center" width="300">&nbsp;</td>';
						$boletim .= '<td align="center" width="50">R</td>';
						$boletim .= '<td align="center" width="50">=</td>';
						$boletim .= '<td align="left"   width="100">REGULAR</td>';
						$boletim .= '<td align="center" width="200">&nbsp;</td>';	
					$boletim .= '</tr>';

					$boletim .= '<tr>';	
						$boletim .= '<td align="center" width="200">&nbsp;</td>';
						$boletim .= '<td align="center" width="100">4º BIMESTRE</td>';
						$boletim .= '<td align="center" width="20">&nbsp;</td>';
						$boletim .= '<td align="center" width="100">30 PONTOS</td>';
						$boletim .= '<td align="center" width="300">&nbsp;</td>';
						$boletim .= '<td align="center" width="50">I</td>';
						$boletim .= '<td align="center" width="50">=</td>';
						$boletim .= '<td align="left"   width="100">INSUFICIENTE</td>';
						$boletim .= '<td align="center" width="200">&nbsp;</td>';	
					$boletim .= '</tr>';
					
					$boletim .= '<tr>';	
						$boletim .= '<td align="center" width="100">&nbsp;</td>';
					$boletim .= '</tr>';

					$boletim .= '<tr>';	
						$boletim .= '<td align="center" width="100">&nbsp;</td>';
					$boletim .= '</tr>';

					$boletim .= '<tr><td><table width="100%"  class="sem_borda_top">'; 
							
							$boletim .= '<tr>';	
								$boletim .= '<td align="left" width="15%">OBSERVAÇÃO: </td>';
								$boletim .= '<td align="left" width="85%">#OBSERVACAO#</td>';
							$boletim .= '</tr>';					
											
					$boletim .= '</table></td></tr>';						
					
			$boletim .= '</table></td></tr>';

		$boletim .= '</table>';
			
			
			



	
	
	
	/*
					$boletim .= '<td align="center"><span class="label">2º BIMESTRE</span>';
						$boletim .= '<tr><td><table border="1" width="100%" >';
						$boletim .= '<td align="left"><span class="label">NOTA</b></span></td>';
						$boletim .= '<td align="left"><span class="label">FALTA</b></span></td>';
						$boletim .= '</table></td></tr>';	
					$boletim .= '</td>';
					
					$boletim .= '<td align="center"><span class="label">&nbsp;</span>';'</td>';
					$boletim .= '<td align="center"><span class="label">3º BIMESTRE</span>';'</td>';
					$boletim .= '<td align="center"><span class="label">4º BIMESTRE</span>';'</td>';
					$boletim .= '<td align="center"><span class="label">TOTAL</span>';'</td>';
					$boletim .= '<td align="center"><span class="label">PROVA</span>';'</td>';
					$boletim .= '<td align="center"><span class="label">SITUAÇÃO</span>';'</td>';	 */

	/*
	$boletim .= '<tr rowspan="3">';
	$boletim .= '<td align="left" width="25%">';
	$boletim .= '<span id="logo_colegio"></span>';	
	$boletim .= '</td>';
	$boletim .= '</tr>';	
	
	
	$boletim .= '<tr>';
	$boletim .= '<td><span class="label">Sacado</span><b>#ALUNO_NOME#</b><br />#ALUNO_SERIE#</td>';
	$boletim .= '<td><span class="label">Vencimento</span><br /><p align="right"><b>#DATA_VENCIMENTO#</b></p></td>';
	$boletim .= '<td><span class="label">Vencimento</span><br /><p align="right"><b>#DATA_VENCIMENTO#</b></p></td>';
	$boletim .= '</tr>';

	$boletim .= '<tr>';
	$boletim .= '<td align="right"><br />VALOR DA PARCELA</td>';
	$boletim .= '<td align="right"><br /><span class="dinheiro">R$ #VALOR_PARCELA#</span></td>';
	$boletim .= '<td align="right"><br /><span class="dinheiro">R$ #VALOR_PARCELA#</span></td>';
	$boletim .= '</tr>';

	$boletim .= '<tr>';
	$boletim .= '<td class="sem_borda_bottom">';
	$boletim .= '<b>Mensalidade de #MENSALIDADE_MES_ANO#</b>';
	$boletim .= '<br /><b>Instruções</b>';
	$boletim .= '</td>';
	$boletim .= '<td class="valores"><span class="label">(+) Multa/Juros</span>&nbsp;</td>';
	$boletim .= '<td class="valores"><span class="label">(+) Multa/Juros</span>&nbsp;</td>';
	$boletim .= '</tr>';
	
	$boletim .= '<tr>';
	$boletim .= '<td rowspan="4">Desc. de  R$ 10,00 para pagtº até dia 7<br />Após o venc. multa de 2% acrescida<br />de juros de mora de 0,5%</td>';
	$boletim .= '</tr>';	
	
	$boletim .= '<tr>';
	$boletim .= '<td class="valores"><span class="label">(-) Desc/Abat</span><span class="dinheiro">#VALOR_CREDITO#</span></td>';
	$boletim .= '<td class="valores"><span class="label">(-) Desc/Abat</span><span class="dinheiro">#VALOR_CREDITO#</span></td>';
		
	$boletim .= '</tr>';	

	$boletim .= '<tr>';
	$boletim .= '<td class="valores"><span class="label">Outros</span>&nbsp;</td>';
	$boletim .= '<td class="valores"><span class="label">Outros</span>&nbsp;</td>';
	$boletim .= '</tr>';

	$boletim .= '<tr>';
	$boletim .= '<td class="valores"><span class="label">Valor Cobrado</span>&nbsp;</td>';
	$boletim .= '<td class="valores"><span class="label">Valor Cobrado</span>&nbsp;</td>';
	$boletim .= '</tr>';	
	
	$boletim .= '</table><div class="divisao"></div>';
	
	
	
	*/
	
	
	
	
	/*
	
	
	
	
	
	$controle = 0;
	
	foreach ($mensalidades as $mensalidade) {

		$total_mes = 0;
		$total_credito = 0;
		$total_debito = 0;
		
		foreach ($mensalidade['AlunoFinanceiroDetalhe'] as $detalhe) {
			
			if ($detalhe['tipo'] == 'D') {
				$total_mes += $this->Sistema->money_to_store($detalhe['valor']);
				$total_debito += $this->Sistema->money_to_store($detalhe['valor']);
			} else {
				$total_mes -= $this->Sistema->money_to_store($detalhe['valor']);
				$total_credito += $this->Sistema->money_to_store($detalhe['valor']);
			}
		}
		
		$mes_ano = $meses[$mensalidade['AlunoFinanceiro']['mes']] . '/' . $ano;
		
		$valor_credito = ($total_credito > 0) ? 'R$ ' . $this->Sistema->money_to_view($total_credito) : '';
		
		$boletim_aluno = $boletim;
		$boletim_aluno = str_replace('#ALUNO_NOME#', strtoupper($aluno['Aluno']['nome']), $boletim_aluno);
		$boletim_aluno = str_replace('#ALUNO_SERIE#', $matricula['TipoSerie']['nome'] , $boletim_aluno);
		$boletim_aluno = str_replace('#DATA_VENCIMENTO#', $mensalidade['AlunoFinanceiro']['data_vencimento'] , $boletim_aluno);
		$boletim_aluno = str_replace('#VALOR_PARCELA#', $this->Sistema->money_to_view($total_debito), $boletim_aluno);
		$boletim_aluno = str_replace('#VALOR_CREDITO#', $valor_credito, $boletim_aluno);
		$boletim_aluno = str_replace('#MENSALIDADE_MES_ANO#', $mes_ano, $boletim_aluno);
		
		
		echo $boletim_aluno;
			
        $controle++;
		
		if ($controle == 2) {
			$controle = 0;
			echo '<p class="quebra"></p>';
		} 
	}
	
*/	
	
	echo $boletim;
